package com.woniuxy.config;

import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;


public class ConditionalMatch implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        Environment environment = context.getEnvironment();
        String property = environment.getProperty("spring.datasource.url");
        String druidProperty = environment.getProperty("spring.datasource.druid.main.url");
        return !(StringUtils.isBlank(property) && StringUtils.isBlank(druidProperty));
    }
}
